﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebSchedulerDemo.xml.Default" %>
<%@ Register Assembly="ComponentGo.Web" Namespace="ComponentGo.Web" TagPrefix="go" %>
<%@ Register Assembly="ComponentGo.Web.Schedulers" Namespace="ComponentGo.Web.Schedulers"
    TagPrefix="gos" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Scheduler C# Demo</title>
    <script language="javascript" type="text/javascript">
<!--

function beforeItemMenu() {
    var it = SchObj.get_ClickedItem();
    if (it==null) return;
   
    var s = it.get_DisplayText(); 
    
    ItemMenuObj.get_Items()[2].set_Text(s!=null && s.indexOf("important")>=0 ? "Reset important" : "Set important");
    ItemMenuObj.get_Items()[3].set_Text(s!=null && s.indexOf("busy")>=0 ? "Reset busy" : "Set busy");
}

function dt() {
    return SchObj.get_ClickedDateTime().getTime();
}

function row() {
    if (SchObj.get_ClickedRow()==null)
        return "0";
    return SchObj.get_ClickedRow().get_ResourceID();
}

// -->
    </script>

</head>
<body>
    <form id="form1" runat="server">
        <div>
            <h3>
                <span style="font-family: Verdana">C# Demo</span></h3>
            <span style="font-size: 10pt; font-family: Verdana">Sample project planning program
                based on ASP.NET ComponentGo.Web.Schedulers.<strong>Scheduler</strong> and ComponentGo.Web.<strong>ContextMenu</strong>.<br />
                Data is stored in XML file.<br />
            </span>
            <gos:Scheduler ID="Sch" runat="server" BackColor="WhiteSmoke" Caption="Project's items"
                Font-Names="Verdana" Font-Size="Small" FreeDateColor="LightCoral" FreeTimeColor="Khaki"
                Height="300px" HorizontalHeaderLine="1px Black Solid" HorizontalLine="1px Silver Solid"
                ObjectID="SchObj" VerticalLine0="2px Silver Solid" VerticalLine1="1px Silver Solid"
                VerticalResourceLine="1px Silver Solid" Width="100%" NumberOfCols="62" TimeResolution="HalfDay"
                OnAction="Sch_Action" OnRowChanged="Sch_RowChanged" FirstDateTime="2006-08-01"
                OnItemChanged="Sch_ItemChanged" OnCallbackScript="Sch_CallbackScript" BehaviorOptions="AllowOverlapItems, Default">
                <BodyStyle BackColor="LemonChiffon" ContextMenuID="BodyMenu">
                    <EventDblClick PostBackUrl="~/xml/PlanItem.aspx?dt={dt()}&amp;row={row()}" />
                </BodyStyle>
                <TimeLineStyle Font-Size="X-Small" ResourceImage="Gray">
                </TimeLineStyle>
                <CaptionStyle HorizontalAlign="Center" ResourceImage="Blue">
                </CaptionStyle>
                <ResourceListStyle BackColor="Snow" ContextMenuID="ResourcesMenu">
                    <EventDblClick PostBackUrl="~/xml/Project.aspx?id={SchObj.get_ClickedRow().get_ResourceID()}" />
                </ResourceListStyle>
                <ResourceHeaderStyle BackColor="213, 225, 255">
                </ResourceHeaderStyle>
                <Columns>
                    <gos:ResourceColumn ShowTree="True" Text="Name">
                    </gos:ResourceColumn>
                    <gos:ResourceColumn DataIndex="1" Text="Description" Width="300px">
                    </gos:ResourceColumn>
                </Columns>
                <DefaultItemStyle ContextMenuID="ItemMenu">
                    <EventDblClick PostBackUrl="~/xml/PlanItem.aspx?id={SchObj.get_ClickedItem().get_ItemID()}" />
                </DefaultItemStyle>
            </gos:Scheduler>
            <span style="font-size: 8pt; font-family: Verdana">Use right mouse button on projects
                grid or items plan grid to expand a menu.<br />
                Double clicking a mouse opens a form.<br />
                <asp:Label ID="ErrorLabel" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label><br />
                <asp:LinkButton ID="DefaultDataLink" runat="server" OnClick="DefaultDataLink_Click">Restore default resources and items</asp:LinkButton></span>
            <go:ContextMenuBox ID="ResourcesMenu" runat="server" Font-Names="Tahoma" Font-Size="8pt">
                <Items>
                    <go:MenuActionItem Text="Insert a subproject" OnClientAction="SchObj.DoAction(&quot;new_sub_res&quot;);">
                    </go:MenuActionItem>
                    <go:MenuActionItem Text="Insert a new project" OnClientAction="SchObj.DoAction(&quot;new_res&quot;);">
                    </go:MenuActionItem>
                    <go:MenuSeparatorItem />
                    <go:MenuActionItem Text="Color">
                        <SubItems>
                            <go:MenuActionItem Text="Not set" OnClientAction="SchObj.DoAction(&quot;rescolor&quot;, &quot;&quot;);">
                            </go:MenuActionItem>
                            <go:MenuSeparatorItem />
                            <go:MenuActionItem OnClientAction="SchObj.DoAction(&quot;rescolor&quot;, &quot;Gainsboro&quot;);"
                                Text="Gainsboro">
                            </go:MenuActionItem>
                            <go:MenuActionItem OnClientAction="SchObj.DoAction(&quot;rescolor&quot;, &quot;NavajoWhite&quot;);"
                                Text="NavajoWhite">
                            </go:MenuActionItem>
                            <go:MenuActionItem OnClientAction="SchObj.DoAction(&quot;rescolor&quot;, &quot;Gold&quot;);"
                                Text="Gold">
                            </go:MenuActionItem>
                            <go:MenuActionItem OnClientAction="SchObj.DoAction(&quot;rescolor&quot;, &quot;Chartreuse&quot;);"
                                Text="Chartreuse">
                            </go:MenuActionItem>
                            <go:MenuActionItem OnClientAction="SchObj.DoAction(&quot;rescolor&quot;, &quot;Aquamarine&quot;);"
                                Text="Aquamarine">
                            </go:MenuActionItem>
                            <go:MenuActionItem OnClientAction="SchObj.DoAction(&quot;rescolor&quot;, &quot;LightSkyBlue&quot;);"
                                Text="LightSkyBlue">
                            </go:MenuActionItem>
                            <go:MenuActionItem OnClientAction="SchObj.DoAction(&quot;rescolor&quot;, &quot;Violet&quot;);"
                                Text="Violet">
                            </go:MenuActionItem>
                            <go:MenuActionItem OnClientAction="SchObj.DoAction(&quot;rescolor&quot;, &quot;Pink&quot;);"
                                Text="Pink">
                            </go:MenuActionItem>
                        </SubItems>
                    </go:MenuActionItem>
                    <go:MenuSeparatorItem />
                    <go:MenuActionItem Text="Delete a project" OnClientAction="SchObj.DoAction(&quot;delete_res&quot;);">
                    </go:MenuActionItem>
                </Items>
            </go:ContextMenuBox>
            <go:ContextMenuBox ID="ItemMenu" runat="server" Font-Names="Tahoma" Font-Size="8pt">
                <Items>
                    <go:MenuActionItem Text="Color">
                        <SubItems>
                            <go:MenuActionItem Text="Not set" OnClientAction="SchObj.DoAction(&quot;itemcolor&quot;, &quot;&quot;);">
                            </go:MenuActionItem>
                            <go:MenuSeparatorItem />
                            <go:MenuActionItem OnClientAction="SchObj.DoAction(&quot;itemcolor&quot;, &quot;Gainsboro&quot;);"
                                Text="Gainsboro">
                            </go:MenuActionItem>
                            <go:MenuActionItem OnClientAction="SchObj.DoAction(&quot;itemcolor&quot;, &quot;NavajoWhite&quot;);"
                                Text="NavajoWhite">
                            </go:MenuActionItem>
                            <go:MenuActionItem OnClientAction="SchObj.DoAction(&quot;itemcolor&quot;, &quot;Gold&quot;);"
                                Text="Gold">
                            </go:MenuActionItem>
                            <go:MenuActionItem OnClientAction="SchObj.DoAction(&quot;itemcolor&quot;, &quot;Chartreuse&quot;);"
                                Text="Chartreuse">
                            </go:MenuActionItem>
                            <go:MenuActionItem OnClientAction="SchObj.DoAction(&quot;itemcolor&quot;, &quot;Aquamarine&quot;);"
                                Text="Aquamarine">
                            </go:MenuActionItem>
                            <go:MenuActionItem OnClientAction="SchObj.DoAction(&quot;itemcolor&quot;, &quot;LightSkyBlue&quot;);"
                                Text="LightSkyBlue">
                            </go:MenuActionItem>
                            <go:MenuActionItem OnClientAction="SchObj.DoAction(&quot;itemcolor&quot;, &quot;Violet&quot;);"
                                Text="Violet">
                            </go:MenuActionItem>
                            <go:MenuActionItem OnClientAction="SchObj.DoAction(&quot;itemcolor&quot;, &quot;Pink&quot;);"
                                Text="Pink">
                            </go:MenuActionItem>
                        </SubItems>
                    </go:MenuActionItem>
                    <go:MenuSeparatorItem />
                    <go:MenuActionItem OnClientAction="SchObj.DoAction(&quot;item_important&quot;);"
                        Text="Important">
                    </go:MenuActionItem>
                    <go:MenuActionItem OnClientAction="SchObj.DoAction(&quot;item_busy&quot;);" Text="Busy">
                    </go:MenuActionItem>
                    <go:MenuSeparatorItem />
                    <go:MenuActionItem OnClientAction="SchObj.DoAction(&quot;delete_item&quot;);" Text="Delete item">
                    </go:MenuActionItem>
                </Items>
                <EventMenuActivate ClientScript="beforeItemMenu()" />
            </go:ContextMenuBox>
            <go:ContextMenuBox ID="BodyMenu" runat="server" Font-Names="Tahoma" Font-Size="8pt">
                <Items>
                    <go:MenuActionItem OnClientAction="SchObj.DoAction(&quot;new_item&quot;, &quot;1&quot;);"
                        Text="New Item - 1 day">
                    </go:MenuActionItem>
                    <go:MenuActionItem OnClientAction="SchObj.DoAction(&quot;new_item&quot;, &quot;2&quot;);"
                        Text="New Item - 2 days">
                    </go:MenuActionItem>
                    <go:MenuActionItem OnClientAction="SchObj.DoAction(&quot;new_item&quot;, &quot;7&quot;);"
                        Text="New Item - week">
                    </go:MenuActionItem>
                </Items>
            </go:ContextMenuBox>
            <p style="text-align: center">
                <span style="font-size: 8pt; font-family: Verdana"><a href="http://www.componentgo.com">
                    www.componentgo.com</a></span></p>
        </div>
    </form>
</body>
</html>
